home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
contro2r
/
form4.frm
< prev
next >
Wrap
Text File
|
1999-04-06
|
6KB
|
232 lines
VERSION 5.00
Begin VB.Form Form4
BorderStyle = 1 'Fixed Single
Caption = "Scan File"
ClientHeight = 2640
ClientLeft = 45
ClientTop = 330
ClientWidth = 6855
LinkTopic = "Form4"
MaxButton = 0 'False
ScaleHeight = 2640
ScaleWidth = 6855
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton seek
BackColor = &H00C0C0C0&
Caption = "&Seek"
BeginProperty Font
Name = "Times New Roman"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 5880
Picture = "Form4.frx":0000
Style = 1 'Graphical
TabIndex = 9
ToolTipText = "Seek For *ico and load it"
Top = 960
Width = 855
End
Begin VB.CommandButton load
Caption = "&Load"
BeginProperty Font
Name = "Times New Roman"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 5880
Picture = "Form4.frx":0442
Style = 1 'Graphical
TabIndex = 8
ToolTipText = "Load Record Into Database"
Top = 1800
Width = 855
End
Begin VB.ListBox List2
Height = 2010
Left = 3960
TabIndex = 5
Top = 360
Width = 1815
End
Begin VB.FileListBox File1
Height = 1650
Left = -1320
MultiSelect = 2 'Extended
Pattern = "*.ico"
TabIndex = 4
Top = -1200
Visible = 0 'False
Width = 1815
End
Begin VB.CommandButton Command1
Caption = "&Scan"
Height = 735
Left = 5880
Picture = "Form4.frx":0884
Style = 1 'Graphical
TabIndex = 3
Top = 120
Width = 855
End
Begin VB.ListBox List1
Height = 2010
Left = 2040
TabIndex = 2
Top = 360
Width = 1815
End
Begin VB.DirListBox Dir1
Height = 1890
Left = 120
TabIndex = 1
Top = 480
Width = 1815
End
Begin VB.DriveListBox Drive1
Height = 315
Left = 120
TabIndex = 0
Top = 120
Width = 1815
End
Begin VB.Label Label2
Caption = "Pathname"
Height = 255
Left = 3960
TabIndex = 7
Top = 120
Width = 1815
End
Begin VB.Label Label1
Caption = "Filename"
Height = 255
Left = 2040
TabIndex = 6
Top = 120
Width = 1815
End
End
Attribute VB_Name = "Form4"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim InitialFolder
Dim totalFiles As Integer
Private Sub Drive1_Change()
drvc2
End Sub
Private Sub Command1_Click()
On Error GoTo pathac
totalFiles = 0
List1.clear
List2.clear
ChDrive Drive1.Drive
ChDir Dir1.Path
InitialFolder = CurDir
Me.MousePointer = 11
ScanFolders
Me.MousePointer = 0
MsgBox "There are " & totalFiles & " under the " & InitialFolder & " folder", vbInformation, "dyr_workshop"
Exit Sub
pathac:
MsgBox "There's Some Path Access Errorr"
Exit Sub
End Sub
Sub ScanFolders()
Dim subFolders As Integer
Dim i As Integer
For i = 0 To File1.ListCount - 1
File1.Selected(i) = True
List1.AddItem File1.filename
List2.AddItem File1.Path
Next i
totalFiles = totalFiles + File1.ListCount
subFolders = Dir1.ListCount
If subFolders > 0 Then
For i = 0 To subFolders - 1
ChDir Dir1.List(i)
Dir1.Path = Dir1.List(i)
File1.Path = Dir1.List(i)
Form1.Refresh
ScanFolders
Next
End If
File1.Path = Dir1.Path
MoveUp
End Sub
Sub MoveUp()
If Dir1.List(-1) <> InitialFolder Then
ChDir Dir1.List(-2)
Dir1.Path = Dir1.List(-2)
End If
End Sub
Private Sub Dir1_Change()
ChDir Dir1.Path
File1.Path = Dir1.Path
End Sub
Private Sub Form_Load()
ChDrive App.Path
ChDir App.Path
End Sub
Private Sub List1_Click()
List2.ListIndex = List1.ListIndex
End Sub
Private Sub List2_Click()
List1.ListIndex = List2.ListIndex
End Sub
Private Sub load_Click()
Dim i As Integer
For i = 0 To List1.ListCount - 1
If List1.Selected(i) Then
Form1.Data1.Recordset.AddNew
Form1.Text1.Text = List1.List(i)
Form1.Text2.Text = List2.List(i)
If Right(List1.Text, 1) = "\" Then
Form1.Image1.Picture = LoadPicture(Form1.Text2.Text & Form1.Text1.Text)
Else
Form1.Image1.Picture = LoadPicture(Form1.Text2.Text & "\" & Form1.Text1.Text)
End If
Form1.Image1.Refresh
Form1.Data1.Recordset.Update
Form1.Data1.Recordset.MoveLast
End If
Next i
End Sub
Private Sub seek_Click()
On Error GoTo xyz
Me.MousePointer = 11
Dim i As Integer
For i = 0 To List1.ListCount - 1
List1.Selected(i) = True
load_Click
Next i
Me.MousePointer = 0
MsgBox i & " Records Are Added", vbInformation, "dyr_workshop"
Exit Sub
xyz:
MsgBox "There's Nothing To Select", vbCritical, "dyr_workshop"
Exit Sub
End Sub